package mn.idax.exchange.otc.mapper;

import mn.idax.exchange.otc.domain.openapi.GetBalanceDTO;
import mn.idax.exchange.otc.domain.openapi.GetBalanceRequest;
import mn.idax.exchange.otc.entity.Account;
import mn.idax.exchange.otc.entity.AccountExample;
import mn.idax.exchange.otc.vo.AccountFrozenDTO;
import mn.idax.exchange.otc.vo.AccountUnFrozenDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.RowBounds;

import java.util.List;

public interface AccountMapper {
    int countByExample(AccountExample example);

    int deleteByExample(AccountExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Account record);

    int insertSelective(Account record);

    List<Account> selectByExampleWithBLOBsWithRowbounds(AccountExample example, RowBounds rowBounds);

    List<Account> selectByExampleWithBLOBs(AccountExample example);

    List<Account> selectByExampleWithRowbounds(AccountExample example, RowBounds rowBounds);

    List<Account> selectByExample(AccountExample example);

    Account selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Account record, @Param("example") AccountExample example);

    Account selectByUserIdCoinId(@Param("userId")Integer userId,@Param("coinId")Integer coinId);
    Account selectByUserIdCoinCode(@Param("userId")Integer userId,@Param("coinCode")String coinCode);

    int updateByExampleWithBLOBs(@Param("record") Account record, @Param("example") AccountExample example);

    int updateByExample(@Param("record") Account record, @Param("example") AccountExample example);

    int updateByPrimaryKeySelective(Account record);

    int updateByPrimaryKeyWithBLOBs(Account record);

    int updateByPrimaryKey(Account record);

    int changeAccount(Account record);

    //冻结用户部分资金
    int forzenUserAccount(AccountFrozenDTO accountFrozenDTO);

    //解冻用户部分资金
    int unforzenUserAccount(AccountUnFrozenDTO accountUnFrozenDTO);

    int updateByNative(Account account);

    //转账给买家
    int transferToBuyer(AccountUnFrozenDTO accountUnFrozenDTO);

    //扣除卖家可用金额
    int transferBySeller(AccountUnFrozenDTO accountUnFrozenDTO);

    //收取广告主手续费
    int getServiceCharge(AccountFrozenDTO accountFrozenDTO);

    List<GetBalanceDTO> openApiGetBalance(GetBalanceRequest getBalanceRequest);
}